package com.dodock.android.banglapapers.ui;

import android.app.Activity;
import android.os.Bundle;
import android.webkit.WebView;

import com.dodock.android.banglapapers.BanglaNews;
import com.dodock.android.banglapapers.MyApplication;
import com.dodock.android.banglapapers.R;
import com.google.analytics.tracking.android.GoogleAnalytics;
import com.google.analytics.tracking.android.Tracker;

public class ArchiveActivity extends Activity {

	WebView mWebView;
	
	private Tracker mGaTracker;
	private GoogleAnalytics mGaInstance;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
		
		//Google Analytics
		try{
		    mGaInstance = GoogleAnalytics.getInstance(this);
		    mGaTracker = mGaInstance.getTracker(getResources().getString(R.string.ga_trackingId));
		}
		catch (Exception e) {
		}
		//--Google Analytics
		
		
		setContentView(R.layout.archive);

//		WebViewClient yourWebClient = new WebViewClient() {
//			// Override page so it's load on my view only
//			@Override
//			public boolean shouldOverrideUrlLoading(WebView view, String url) {
//				if (url.equalsIgnoreCase(BanglaNews.ARCHIVE_URL))
//					return false;
//				return true;
//			}
//		};

		// Get Web view
		mWebView = (WebView) findViewById(R.id.web_view);
		mWebView.getSettings().setJavaScriptEnabled(true);
		mWebView.getSettings().setSupportZoom(true);
		mWebView.getSettings().setBuiltInZoomControls(true);
//		mWebView.setWebViewClient(yourWebClient);

		// Load URL
		mWebView.loadUrl(BanglaNews.ARCHIVE_URL);

	}

	@Override
	protected void onStart() {
		super.onStart();
		try {
			mGaTracker.sendView("/BanglaPapersArchiveFacebookPage");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	protected void onStop() {
		super.onStop();
	}
	
	@Override
	protected void onResume() {
		super.onResume();
		com.facebook.Settings.publishInstallAsync(this, MyApplication.fb_app_id);
	}
}
